const User = require("./ORM");

// 添加
const addOne = param => User.create(param);
const addMany = param => User.insertMany(param);

// 删除
const deleteOne = id => User.deleteOne(id)
const deleteMany = ids => User.deleteMany(ids)

// 更新
const updateOne = (filter, parmas) => User.updateOne(filter, parmas)
const updateMany = (filter, parmas) => User.updateMany(filter, parmas)

// 查询
// Mongoose提供了多种查询数据的方法，如find，findOne，findById等：
const queryOne = parma => User.findOne(parma);
const queryMany = parma => User.find(parma);

module.exports = {
	addOne,
	addMany,
	deleteOne,
	deleteMany,
	updateOne,
	updateMany,
	queryOne,
	queryMany,
};
